﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CSVFileInfo.cs" company="Collaboris Ltd.">
//   Copyright (c) Collaboris Ltd. All rights Reserved.
// </copyright>
// <summary>
/// Defines a Entity class for converting the Excel
///  sheet into DataSet object.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Collaboris.Saf.Actions.Entities
{

    using Engine;
    using System.Data;
    using System;

    using SharePoint.Wss.Attributes;
    using SharePoint.Wss.Entities;

    [Serializable]
    [CollaborisClass(
         Title = "CSV File Info",
         ReleaseStatus = ReleaseStatus.Stable,
         DisableDocumentation = false,
         ContactAuthorEmail = "Support@Collaboris.co.uk",
         Summary = "This class defines the settings to export a CSV file as a DataSet.",
         Remarks = "The DataSet is stored in a property within the entity called 'CsvDataSet'. " +
                    "This can then be passed into subsequent actions using output properties."
    )]
    public class CSVFileInfo : EntityBase
    {
        private string _tableName;

        [CollaborisProperty(
          Summary = "The internal name of the data table.",
          Title = "Table Name",
          Example = "TestTasks",
          Required = true,
          InputHint = InputHint.SingleText
          )]
        public string TableName
        {
            get
            {
                return this._tableName;
            }
            set
            {
                this._tableName = value;
            }
        }

        private DataSet csvDataSet;

        [CollaborisProperty(
          Summary = "The DataSet that will be returned from the CSV File.",
          Title = "Table Name",
          OutputProperty = true
          )]
        public DataSet CsvDataSet
        {
            get
            {
                return this.csvDataSet;
            }
            set
            {
                this.csvDataSet = value;
            }
        }

        private string filePath;

        [CollaborisProperty(
          Summary = "The full path and file name of the CSV File.",
          Title = "File Path",
          Example = @"${CurrentDirectory}\TestTasks.csv",
          Required = true,
          InputHint = InputHint.SingleText
          )]
        public string FilePath
        {
            get
            {
                return filePath;
            }
            set
            {
                filePath = value;
            }
        }
    }
}
